<?php

/** 
* hr.php
*
* Create on 2015-4-13 15:20:08
* Create by Zhou.Zhe
*/
namespace haibao\cms\data;


class Hr extends \haibao\cms\data\BaseMysql {
	
	public function __construct() {
		parent::__construct ( '\haibao\cms\model\data\Job' );
	}
	public function getAllJOb(){
	    $nowTime = new \DateTime();
	    $nowTime = $nowTime->format('Y-m-d');
	    $sql = "select a.Num,a.JobArea,a.JobDesc,a.JobRequire,a.Id,a.CateId,a.Title,b.CateName from Job a LEFT JOIN  JobCategory b on a.CateId=b.Id where a.Status=1 and b.Status=1 and a.StartTime<='$nowTime' and EndTime>='$nowTime'"; 
	    $result = $this->query($sql);
	    $allJobs = array();
	    while($result->fetch_assoc()){
	        $key = $result->getData('CateName');
	        $k = $result->getData('Title');
	        $allJobs[$key][$k]['Num'] = $result->getData('Num');
	        $allJobs[$key][$k]['JobArea'] = $result->getData('JobArea');
	        $allJobs[$key][$k]['JobDesc'] = $result->getData('JobDesc');
	        $allJobs[$key][$k]['JobRequire'] = $result->getData('JobRequire');
	        $allJobs[$key][$k]['CateId'] = $result->getData('CateId');
	        $allJobs[$key][$k]['Id'] = $result->getData('Id');
	    }
	    return $allJobs;
	}
}